import 'package:flutter/material.dart';

class MyApp19 extends StatelessWidget {
  const MyApp19({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      //导航条
      appBar: AppBar(
        title: const Text(
          'Flutter初体验',
          style: TextStyle(color: Colors.white, fontSize: 20),
        ),
        backgroundColor: Colors.pink,
        centerTitle: true,
      ),
      //主体区域
      body: GridView.builder(
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          //固定个数
          crossAxisCount: 3,
          //设置主轴的间距
          mainAxisSpacing: 10,
          //设置侧轴的间距
          crossAxisSpacing: 10,
          //设置宽高比
          childAspectRatio: 1,
        ),
        itemBuilder: (BuildContext context, int index) {
          return Container(
            color: Colors.red,
            alignment: Alignment.center,
            child: Text('传智播客 $index'),
          );
        },
        itemCount: 60,
      ),
    );
  }
}
